package pages;

import java.util.List;

import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.android.AndroidElement;
import utils.BaseAction;

public class LoginPage {
	private AndroidDriver<AndroidElement> driver;
	private BaseAction action;
	
	public LoginPage(AndroidDriver<AndroidElement> driver) {
		this.driver = driver;
		this.action = new BaseAction(driver);
	}
	
	public AndroidElement server_address() {
		return driver.findElementByName("服务器");
	}
	
	public AndroidElement login_name() {
		return driver.findElementByName("账号");
	}
	public AndroidElement login_password() {
		return driver.findElementByName("密码");
	}
	
	public AndroidElement login_button() {
		return driver.findElementByAccessibilityId("登录");
	}
	public void login(String address, String name,String password) throws InterruptedException {
		action.setValue(server_address(), address);
		action.setValue(login_name(), name);
		action.setValue(login_password(), password);
		action.click(login_button());
	}

}
